Don't crash if we don't have a placed/found time or a missing 'notes' field.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 2 Jun 2005 22:03:50 +0000 (22:03 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 2 Jun 2005 22:03:50 +0000 (22:03 +0000)
gpsbabel/maggeo.c

index f2674a479fb5625ee42fb22c66422ed656abd0cb..3bf237cc11f33d5143ab4a93721907c65894b49a 100644 (file)
@@ -83,9 +83,9 @@ maggeo_fmtdate(time_t t)
        char *cbuf = xmalloc(SZ);
        struct tm *tm = NULL;
        int date;
-
        tm = gmtime(&t);
-       if ( tm ) {
+
+       if ( t && tm ) {
                date = tm->tm_mday * 100000 + (1+tm->tm_mon) * 1000 + 
                           tm->tm_year;
                snprintf(cbuf, SZ, "%07d", date);
@@ -154,7 +154,7 @@ maggeo_waypt_pr(const waypoint *waypointp)
        ctype = gs_get_cachetype(waypointp->gc_data.type);
        placeddate = maggeo_fmtdate(waypointp->creation_time);
        lfounddate = maggeo_fmtdate(waypointp->gc_data.last_found);
-       cname = mkshort(desc_handle, waypointp->notes);
+       cname = mkshort(desc_handle, waypointp->notes ? waypointp->notes : waypointp->shortname);
        placer = waypointp->gc_data.placer;
 
        /*